@model IEnumerable<University.Models.User>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            FirstName
        </th>
        <th>
            LastName
        </th>
        <th>
            Birthday
        </th>
        <th>
            PhoneNumber
        </th>
        <th>
            Group
        </th>
        <th>
            Marks
        </th>
        <th>
            Account
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.UserId }) |
            @Html.ActionLink("Details", "Details", new { id=item.UserId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.UserId })
        </td>
        <td>
			@item.FirstName
        </td>
        <td>
			@item.LastName
        </td>
        <td>
			@String.Format("{0:g}", item.Birthday)
        </td>
        <td>
			@item.PhoneNumber
        </td>
        <td>
			@(item.Group == null ? "None" : item.Group.Name)
        </td>
        <td>
			@(item.Marks == null ? "None" : item.Marks.Count.ToString())
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.Account).ToString()
        </td>
    </tr>
}

</table>


